package com.smasher.print.em;

import android.content.Context;

import com.google.auto.service.AutoService;
import com.smasher.print.core.PrintDelegate;
import com.smasher.print.core.PrintPlugin;

@AutoService(PrintPlugin.class)
public class P5820PrintPlugin implements PrintPlugin {
    @Override
    public String getPluginId() {
        return "p5820";
    }

    @Override
    public String getPluginName() {
        return "5820系列打印机";
    }

    @Override
    public boolean isAvailable() {
        try {
            // 检查必要的类是否存在
            Class.forName("com.printsdk.PrintSerializable");
            return true;
        } catch (ClassNotFoundException e) {
            return false;
        }
    }

    @Override
    public PrintDelegate createPrintDelegate(Context context) {
        if (!isAvailable()) {
            throw new IllegalStateException("P5820 printer SDK not available");
        }
        return new Printer5820(context);
    }
}
